package com.liuqi.loggers.core.converters;

import com.liuqi.loggers.core.Converter;
import com.liuqi.loggers.core.LoggerEvent;

/**
 * converter %thread
 *
 * @author liuqi
 * @date 2024/11/5 16:56
 **/
public class ThreadConverter implements Converter {

    private static final String C_S = ANSIConstants.ESC_START + ANSIConstants.MAGENTA_FG + ANSIConstants.ESC_END;
    private static final String C_E = ANSIConstants.ESC_START + ANSIConstants.ESC_END;

    @Override
    public String convert(LoggerEvent event) {
        return C_S + event.getThread().getName() + C_E;
    }

    @Override
    public String convert0(LoggerEvent event) {
        return event.getThread().getName();
    }

    @Override
    public String name() {
        return "thread";
    }

}
